package one;

public class Shuzu {
    public static void main(String[] args) {

        int[] arr = new int[10]; //创建一个容量为10的数组;
        arr[0] =1;
        arr[1] =2;
        arr[2] =3;
        arr[3] =4;
        arr[4] =50;
        arr[5] =6;
        arr[6] =7;
        arr[7] =8;
        arr[8] =9;
        arr[9] =10;
        /*
        //求数组中元素的和;
        int sum = 0;
        for (int i = 0;i < arr.length;i++){
            sum += arr[i];
        }
        System.out.println("arr的和为:"+sum);
        */

        //遍历输出数组中所有元素;
        /*
        for (int i = 0;i<arr.length;i++){
            System.out.println("数组中第"+ i +"个元素为:"+ arr[i]);
        }
         */

        //找出数组中元素的最大值;
        int x = 0;
        for (int i = 0;i<arr.length;i++){
            if (arr[i]>x){
                x = arr[i];
            }
        }
        System.out.println(x);







    }
}
